﻿package mortal.game.view.achievement.item
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.achievement.data.*;
    import mortal.game.view.common.*;

    public class AchievementTotalTabCell extends GCellRenderer
    {
        private var _bg:GBitmap;
        private var _selectFilter:ScaleBitmap;
        private var _titleBg:GBitmap;
        private var _numTxt:GTextFiled;
        private var _titleIcon:Array;

        public function AchievementTotalTabCell()
        {
            this._titleIcon = [];
            this._titleIcon = [ImagesConst.AchievemenListTotal, ImagesConst.AchievemenListRole, ImagesConst.AchievemenListEquip, ImagesConst.AchievemenListRide, ImagesConst.AchievemenListGuild, ImagesConst.AchievemenListSociety, ImagesConst.AchievemenListHero, ImagesConst.AchievemenListHide];
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.bitmap(ImagesConst.AchievemenListTabBtnBg, 0, 0, this);
            this._selectFilter = UIFactory.bg(-1, -1, 161, 59, this, ImagesConst.selectFilter);
            this._numTxt = UIFactory.gTextField("12", 104, 35, 50, 20, this);
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = TextFormatAlign.RIGHT;
            this._numTxt.setTextFormat(_loc_1);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose(param1);
            this._bg = null;
            this._selectFilter.dispose(param1);
            this._selectFilter = null;
            this._numTxt.dispose(param1);
            this._numTxt = null;
            if (this._titleBg)
            {
                this._titleBg.dispose(param1);
                this._titleBg = null;
            }
            return;
        }// end function

        override public function set selected(param1:Boolean) : void
        {
            super.selected = param1;
            this._selectFilter.visible = param1;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            var _loc_2:* = param1 as AchievementCategoryNum;
            if (_loc_2 == null)
            {
                return;
            }
            if (this._titleBg)
            {
                this._titleBg.dispose();
            }
            this._titleBg = UIFactory.bitmap(this._titleIcon[_loc_2.id], 35, 17, this);
            if (_loc_2.num == 0)
            {
                this._numTxt.text = "";
            }
            else
            {
                this._numTxt.text = "" + _loc_2.num;
            }
            return;
        }// end function

    }
}
